package io.kiki.sba.registry.server.shared.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

@Setter
@Getter
public class CommonConfig {
    /**
     * server local data center, get from System Property example:
     * nodes.localDataCenter=DefaultDataCenter
     */
    @Value("${nodes.localDataCenter:DefaultDataCenter}")
    private String dataCenter;

    /**
     * server local region, get from System Property example: nodes.localRegion=DEFAULT_ZONE
     */
    @Value("${nodes.localRegion}")
    private String region;

    @Value("#{PropertySplitter.mapOfKeyList('${nodes.localDataCenter:DefaultDataCenter}', '${nodes.metaNode:DefaultDataCenter:localhost}')}")
    private Map<String /*dataCenterId*/, Collection<String>> metaNode;

    @Value("#{PropertySplitter.list('${nodes.localSegmentRegions:}')}")
    private Set<String> localSegmentRegions;


}
